package leetcode;

import java.util.Stack;

public class Offer09 {
    public static class CQueue {
        private Stack<Integer> head = new Stack<Integer>();
        private Stack<Integer> tail = new Stack<Integer>();

        public CQueue() {

        }

        public void appendTail(int value) {
            tail.push(value);
        }

        public int deleteHead() {
            if(head.isEmpty()) {
                while (!tail.isEmpty()) {
                    head.push(tail.pop());
                }
            }
            return head.isEmpty()? -1 :head.pop();
        }
    }
}
